(:
  A procedure to select the contents of the 2nd worksheet in excel
:)
declare boundary-space strip;
import module namespace
    jj = "http://kumquat.emse.fr/utilitaires"
    at "jjutils.xq" ;
    
declare namespace xcl = "urn:schemas-microsoft-com:office:spreadsheet";
<display>{
let $t := $arguments[1]
let $idxarray := for $string in fn:tokenize($arguments[2],",") return xs:integer($string)
let $cols := fn:tokenize($arguments[3],",")
let $d := doc($t)/xcl:Workbook/xcl:Worksheet[position()=$idxarray]
	for $row at $p in $d/xcl:Table/xcl:Row
		return
  		<item>{
    		<info name="time"><time><date>{ $p*4000 }</date><duration>2</duration></time></info>,
    		<info name="src-anchor">{
      		<anchor>{
        		<doc>{ $t }</doc>,
        		<path>{jj:build-Path($row)}</path>
      	  }</anchor>
    		}</info>,
    		for $col at $colp in $cols where $col!="time"
    		return <info name="{$col}">{string($row/xcl:Cell[$colp])}</info>
  		}</item>
}</display>
